﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using BHXH_NT.Properties;

namespace BHXH_NT
{
    public partial class FrmLogin : Form
    {
        public Boolean flagExit;
        public Boolean flagUser;
        private string connectionString = global::BHXH_NT.Properties.Settings.Default.MISBHXH_CAMLAM_CONNECTIONTRING;
        public FrmLogin()
        {
            InitializeComponent();
        }
       
        private void btnOK_Click(object sender, EventArgs e)
        {
           
            if (txtMaNV.Text.ToUpper() == global::BHXH_NT.Properties.Settings.Default.User.ToUpper()
                && txtMauKhau.Text.ToUpper() == global::BHXH_NT.Properties.Settings.Default.Pass.ToUpper())
            {
                ModuleBHXH.admin = true;
                MDIMain frmMDI = (MDIMain)this.MdiParent;
                frmMDI.tsbAcount.Text = "Đăng nhập user : Admin";
                frmMDI.Visibletooltip(true);
                this.Close();
                return;
            }
            else
            {
                MessageBox.Show("Nhập lại User, Pass");
                ModuleBHXH.admin = false;
            }
           
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            flagExit = false;
            this.Close();
        }

        private void FrmLogin_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F12 && e.Shift == true)
            {
                Cursor.Current = Cursors.WaitCursor;
                frmSetting childForm = new frmSetting();
                childForm.Show();
                Cursor.Current = Cursors.Default;
             }
        }
    }
}
